/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.tozo.rest;

import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import hu.tozo.model.GlassfishModel;
import javax.ws.rs.POST;

/**
 * REST Web Service
 *
 */
@Path("gf")
public class GlassfishClusterNode {
    private List<GlassfishModel>models;

    private void buildModels(){
        models=new ArrayList<GlassfishModel>();
        models.add(new GlassfishModel("Mode1","State1"));
        models.add(new GlassfishModel("Mode2","State2"));    
    }
    
    public GlassfishClusterNode() {
        buildModels();
    }

    @POST
    @Consumes("text/plain")
    @Path("start/")
    public void startClusterNode(String instance) {
        System.out.println("GF startClusterNode...:"+instance);
    }

    @POST
    @Consumes("text/plain")
    @Path("stop/")
    public void stopClusterNode(String instance) {
        System.out.println("GF stopClusterNode...:"+instance);
    }
        
    @GET
    @Produces("application/json")
    @Path("load/")
    public String getLoad(){
        System.out.println("Get load data");
        return "20";
    }
    
    @GET
    @Produces("application/json")
    public List<GlassfishModel> listClusterNode() {
        System.out.println("GF listClusterNodes...");
        return models;
    }
    
}
